<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>设置</title>
    <link rel="stylesheet" type="text/css" href="/static/css/weui.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/weui2.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/style.css"/>
    <script src="/static/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/zepto.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/vue.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/all.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="content">
    <h1 class="setTitle">设置</h1>

    <form method="post">
        {{ form.hidden_tag() }}
        <ul class="setList">


            <li>
                <label>异常推送：</label>
                <input class="weui_switch" id="checkbox_YNAbnormal" type="checkbox"
                       {% if data['YNAbnormal'] %}checked{% endif %}/>
            </li>
            <li>
                <label>主页验证：</label>
                <input class="weui_switch " id="checkbox_YNVerification" type="checkbox"
                       {% if data['YNVerification'] %}checked{% endif %}/>
            </li>
            <li>
                <label>默认登录：</label>
                <input class="weui_switch " id="checkbox_YNLogon" type="checkbox"
                       {% if data['YNLogon'] %}checked{% endif %}/>
            </li>
            <li>
                <label>营业推送：</label>
                <input class="weui_switch " id="checkbox_YNBusiness" type="checkbox"
                       {% if data['YNBusiness'] %}checked{% endif %}/>
            </li>

        </ul>
        <div class="refer">
            <button type="submit">保存设置</button>

        </div>
    </form>
</div>
<script type="text/javascript">

        $(".weui_switch").click(function () {
            var that = $(this);

            var target_input = that.attr("id").split("checkbox_")[1];
             console.log(target_input);
            if (that.is(":checked")) {
                that.val("on");

                $('#' + target_input).val(1);
                console.log("开关"+target_input+"当前状态：" + that.val());

            } else {

                that.val("off");
                $('#' + target_input).val(0);
                console.log("开关"+target_input+"当前状态：" + that.val());
            }

        });

</script>
</body>
</html>
